#!/bin/bash
if [ -f /tmp/admin/admin-encry-0.0.1-SNAPSHOT.jar ]; then
        mv -f /tmp/admin/* /application/springcloud/admin/
fi

/usr/local/go/bin/go build /application/springcloud/admin/xjar.go

ps -ef|grep "java -jar /application/springcloud/admin/admin-encry-0.0.1-SNAPSHOT.jar "|grep -v grep|awk '{print "kill -9 " $2}'|sh

logfile=`date +%Y%m%d%H%M%S`

if [ -f /application/springcloud/logs/admin.log ]; then
        mv /application/springcloud/logs/admin.log /application/springcloud/logs/admin_$logfile.sql
fi


nohup /application/springcloud/admin/xjar /application/jdk1.8.0_161/bin/java -jar /application/springcloud/admin/admin-encry-0.0.1-SNAPSHOT.jar --spring.profiles.active=pro -Djava.io.tmpdir=/application/springcloud/tmp >> /application/springcloud/logs/admin.log 2>&1 &
